<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div id="div1">
    <input type="text" v-model="name1">
    <mysite v-bind:name="name1"></mysite>
    <mysite v-bind:name="name1"></mysite>
    <mysite v-bind:name="name1"></mysite>
    <mysite v-bind:name="name1"></mysite>
</div>
<div id="div2">
    <mycom1></mycom1>
</div>
</body>
<script src="../lib/vue.js"></script>
<script>
    // 组件的注册分为两种
    // 1. 全局注册
    // 2. 局部注册


    // 先来看全局注册
    Vue.component('mysite', {
        props: ['name'],
        template: `<span>{{name}}</span>`
    })
    new Vue({
        el: '#div1',
        data: {
            name1: 'zyd'
        }
    })


    // 局部注册
    // 全局注册往往不是完美的,

    var ComponentA = {
        template: `<span>我是局部注册的</span>`
    }

    new Vue({
            el: '#div2',
            data: {
              msgA: 'zyd'
            },
            components: {
                mycom1:  ComponentA
            }
        }
    )
</script>
</html>